Skip to content

test: block curl_cffi in the offline lane and mock Yahoo's retry path - #63

Merged
stefan-jansen merged 1 commit into
mainfrom
fix/offline-guard-curl-cffi
Sep 23, 2026
Merged

stefan-jansen merged 1 commit into
mainfrom
fix/offline-guard-curl-cffi

Conversation

@stefan-jansen

Copy link
Copy Markdown
Contributor

The offline network guard in tests/conftest.py patches Python's socket module, but yfinance sends through curl_cffi, whose libcurl opens sockets in C. Three offline Yahoo tests mocked yf.download only; an empty download retries through yf.Ticker(...).history, which reached Yahoo live. PR #61's Windows job failed with YFRateLimitError from one of them.

  • The guard now rejects curl_cffi Session and AsyncSession requests; two probe tests cover it (both failed before the change).
  • test_empty_response_handling, test_empty_data_raises_symbol_not_found and test_propagates_symbol_not_found_error mock the Ticker retry.

Local: 3656 offline tests pass, ruff, ty.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F6TR4nQDjiPtanA2n4F3Gw

The offline network guard patches Python's socket module, but yfinance
sends through curl_cffi, whose libcurl opens sockets in C. Three offline
Yahoo tests mocked yf.download only; an empty download then retries
through yf.Ticker(...).history, which reached Yahoo live. CI on PR #61
failed on Windows with YFRateLimitError from one of them.

The guard now rejects curl_cffi Session and AsyncSession requests, with
probe tests for both, and the three tests mock the Ticker retry.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01F6TR4nQDjiPtanA2n4F3Gw
Copilot AI lite review requested due to automatic review settings September 23, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@stefan-jansen
stefan-jansen merged commit b410f05 into main Sep 23, 2026
26 checks passed
@stefan-jansen
stefan-jansen deleted the fix/offline-guard-curl-cffi branch September 23, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants